home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / What's New? / Development Kits / USBDDK_v1.0.1_updated / Examples / USBSampleStorageDriver / DriverIcons.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-09-29  |  4.2 KB  |  132 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        DriverIcons.h
  3.  
  4.     Contains:    All declarations and types that are associated with the 
  5.                 Driver's Drive and Media Icons.
  6.  
  7.     Version:    1.0
  8.  
  9.     Copyright:    © 1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11. */
  12.  
  13.  
  14. #ifndef __DRIVERICONS__
  15. #define __DRIVERICONS__
  16.  
  17. #include <MacTypes.h>
  18. #include <Icons.h>
  19.  
  20. // The following structures are from the Prerelease of Universal Headers 3.2
  21. // These support the new 'icns' icon family structures.
  22. // These should be removed once the Headers are updated to UH 3.2
  23.  
  24. /* IconRefs are 32-bit values identifying cached icon data. IconRef 0 is invalid.*/
  25. typedef struct OpaqueIconRef*             IconRef;
  26.  
  27. /*
  28.       IconFamily 'icns' resources contain an entire IconFamily (all sizes and depths).  
  29.    For custom icons, icns IconFamily resources of the custom icon resource ID are fetched first before
  30.    the classic custom icons (individual 'ics#, ICN#, etc) are fetched.  If the fetch of the icns resource
  31.    succeeds then the icns is looked at exclusively for the icon data.
  32.    For custom icons, new icon features such as 32-bit deep icons are only fetched from the icns resource.
  33.    This is to avoid incompatibilities with cut & paste of new style icons with an older version of the
  34.    MacOS Finder.
  35.    DriverGestalt is called with code kdgMediaIconSuite by IconServices after calling FSM to determine a
  36.    driver icon for a particular device.  The result of the kdgMediaIconSuite call to DriverGestalt should
  37.    be a pointer an an IconFamily.  In this manner driver vendors can provide rich, detailed drive icons
  38.    instead of the 1-bit variety previously supported.
  39. */
  40.  
  41. enum {
  42.     kIconFamilyType                = FOUR_CHAR_CODE('icns')
  43. };
  44.  
  45.  
  46.  
  47. struct IconFamilyElement {
  48.     OSType                             elementType;                /* 'ICN#', 'icl8', etc...*/
  49.     Size                             elementSize;                /* Size of this element*/
  50.     unsigned char                     elementData[1];
  51. };
  52. typedef struct IconFamilyElement        IconFamilyElement;
  53.  
  54. struct IconFamilyResource {
  55.     OSType                             resourceType;                /* Always 'icns'*/
  56.     Size                             resourceSize;                /* Total size of this resource*/
  57.     IconFamilyElement                 elements[1];
  58.  
  59. };
  60. typedef struct IconFamilyResource        IconFamilyResource;
  61.  
  62. typedef IconFamilyResource *            IconFamilyPtr;
  63. typedef IconFamilyPtr *                    IconFamilyHandle;
  64.  
  65. /*
  66.    Use the special creator kSystemIconsCreator to get "standard" icons 
  67.    that are not associated with a file, such as the help icon.
  68. */
  69.  
  70. enum {
  71.     kSystemIconsCreator            = FOUR_CHAR_CODE('macs')
  72. };
  73.  
  74. enum {
  75.     kGenericFloppyIcon            = FOUR_CHAR_CODE('flpy')
  76. };
  77.  
  78.  
  79. /*
  80.    IconRefToIconFamily
  81.    This routines returns a new IconFamily that contains the data corresponding
  82.    to the specified IconRef
  83. */
  84.  
  85. EXTERN_API( OSErr )
  86. IconRefToIconFamily                (IconRef                 theIconRef,
  87.                                  IconSelectorValue         whichIcons,
  88.                                  IconFamilyHandle *        iconFamily)                            TWOWORDINLINE(0x7024, 0xAA75);
  89.  
  90.  
  91. /*
  92.    GetIconRef
  93.    
  94.    This routine returns an icon ref for an icon in the desktop database or
  95.    for a registered icon.
  96.    The system registers a set of icon such as the help icon with the creator 
  97.    code kSystemIconCreator. See above for a list of the registered system types.
  98.    The vRefNum is used as a hint on where to look for the icon first. Use 
  99.    kOnSystemDisk if you don't know what to pass.
  100.    This routine increments the reference count of the returned IconRef. Call 
  101.    ReleaseIconRef() when you're done with it.
  102. */
  103.  
  104. EXTERN_API( OSErr )
  105. GetIconRef                        (SInt16                 vRefNum,
  106.                                  OSType                 creator,
  107.                                  OSType                 iconType,
  108.                                  IconRef *                theIconRef)                            TWOWORDINLINE(0x7021, 0xAA75);
  109.  
  110.  
  111.  
  112. // End of Universal Headers 3.2 prerelease info
  113.  
  114. // These structures are for the Black and white 1 bit icons
  115. typedef SInt16             DiskIcon[128];    // Structure for disk icon data (256 bytes)
  116.  
  117. extern DiskIcon         CartridgeIcon;
  118. extern DiskIcon         AppleFloppyMediaIcon;
  119.  
  120. // These variables are used for color icon support.
  121. // They will be set to nil if the IconServicesLib couldn't be found
  122. extern IconFamilyPtr    CartridgeMediaIconFamily;
  123. extern IconFamilyHandle    FloppyMediaIconFamily;
  124.  
  125. // Function call to create the color icon families
  126. extern void BuildMediaIconFamily( void );
  127.  
  128. // Function call to remove the color icon families and reclaim any memory
  129. extern void DestroyMediaIconFamily( void );
  130.  
  131. #endif /* __DRIVERICONS__ */
  132.